/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.exam.paperQuestion.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.exam.paperQuestion.domain.PaperQuestion;
import com.seeyoui.kensite.bussiness.exam.paperQuestion.persistence.PaperQuestionMapper;

/**
 * PaperQuestion
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-01-08
 */

@Service
public class PaperQuestionService extends BaseService {
	
	@Autowired
	private PaperQuestionMapper paperQuestionMapper;

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public PaperQuestion findOne(String id) throws CRUDException{
		return paperQuestionMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param paperQuestion
	 * @return
	 * @throws CRUDException
	 */
	public List<PaperQuestion> findList(PaperQuestion paperQuestion) throws CRUDException {
		return paperQuestionMapper.findList(paperQuestion);
	}
	
	/**
	 * 查询所有数据集合
	 * @param paperQuestion
	 * @return
	 * @throws CRUDException
	 */
	public List<PaperQuestion> findAll(PaperQuestion paperQuestion) throws CRUDException {
		return paperQuestionMapper.findAll(paperQuestion);
	}
	
	/**
	 * 查询数据总数
	 * @param paperQuestion
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(PaperQuestion paperQuestion) throws CRUDException {
		return paperQuestionMapper.findTotal(paperQuestion);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param paperQuestion
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(PaperQuestion paperQuestion) throws CRUDException {
		return paperQuestionMapper.findExTotal(paperQuestion);
	}
	
	/**
	 * 数据新增
	 * @param paperQuestion
	 * @throws CRUDException
	 */
	public void save(PaperQuestion paperQuestion) throws CRUDException{
		paperQuestion.preInsert();
		paperQuestionMapper.save(paperQuestion);
	}
	
	/**
	 * 数据修改
	 * @param paperQuestion
	 * @throws CRUDException
	 */
	public void update(PaperQuestion paperQuestion) throws CRUDException{
		paperQuestion.preUpdate();
		paperQuestionMapper.update(paperQuestion);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		paperQuestionMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param paperQuestion
	 * @throws CRUDException
	 */
	public void remove(PaperQuestion paperQuestion) throws CRUDException{
		paperQuestion.preUpdate();
		paperQuestionMapper.remove(paperQuestion);			
	}
	
}